/*
 *  Disc Catalog
 *  A little application to quickly catalog and find contents of your
 *  DVD archives.
 *
 *  Document.h
 *  The main class for the Document-based Cocoa architecture. This is
 *  also the controller for the documents' main window.
 *
 *  Created by Nicola Gigante on 21/12/08.
 *  Copyright (C) 2008  Nicola Gigante
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#import <Cocoa/Cocoa.h>
#import "Catalog.h"
#include "SearchManager.h"

@interface Document : NSDocument
{	
	// Data
	Catalog *catalog;
	NSTreeController *treeController;
	unsigned scannedDiscs;
	
	// GUI
	IBOutlet NSOutlineView *outline;
	NSPanel *scanSheet;
	NSPanel *customLabelSheet;
	IBOutlet NSTextField *readyLabel;
	IBOutlet NSBox *box;
	IBOutlet NSButton *scanButton;
	IBOutlet NSButton *closeButton;
	IBOutlet NSTextField *statusLabel;
	IBOutlet NSProgressIndicator *indicator;
	IBOutlet NSButton *labelButton;
	IBOutlet NSTextField *labelLabel; // :P
	IBOutlet NSTextField *customLabelField;
	BOOL lastLabelWasCustom;
	
	// Search
	NSSearchField *searchField;
	SearchManager *searchManager;
}

@property (retain) IBOutlet Catalog *catalog;
@property (retain) IBOutlet NSTreeController *treeController;
@property					unsigned scannedDiscs;
@property (retain) IBOutlet NSPanel *scanSheet;
@property (retain) IBOutlet NSSearchField *searchField;
@property (retain)			SearchManager *searchManager;

+ (NSOperationQueue *)sharedOperationQueue;
- (id) init;

- (void) addDisc: (id)sender;
- (void) closeScanSheet:(id)sender;
- (void) startScanning:(id)sender;
- (void) refilter: (id)sender;
- (void) askCustomLabel: (id)sender;
- (void) customLabelFieldEdited: (id)sender;

- (void) beginImportCatalog: (id)sender;

// Edit menu handling
- (void) delete: (id)sender;

@end
